package org.ontobrowser.ontoextract;

import org.w3c.dom.Element;


public class Property {
	
	Element propertyNode;
	
	public Property(Element element){
		propertyNode = element;
	}
	
	public String getLabel()
	{
		String label = RDFDomUtil.getElementAttributeValue(propertyNode, RDFDomUtil.RDFSCHEMA_NS, "label");
		
		return label;
	}
	
	public String getComment()
	{
		String comment = RDFDomUtil.getElementAttributeValue(propertyNode, RDFDomUtil.RDFSCHEMA_NS, "comment");
		
		return comment;
	}
	
	public String getType()
	{
		String type = "unknown";
		Element typeNode = RDFDomUtil.getChildNode(propertyNode, RDFDomUtil.RDFSCHEMA_NS, "range");
		if(typeNode != null)
			type = RDFDomUtil.getElementAttributeValue(typeNode, RDFDomUtil.RDF_NS, "resource");
		
		return type;
	}

	public void print() {
		
		String label = RDFDomUtil.getElementAttributeValue(propertyNode, RDFDomUtil.RDFSCHEMA_NS, "label");
		String comment = RDFDomUtil.getElementAttributeValue(propertyNode, RDFDomUtil.RDFSCHEMA_NS, "comment");
		
		Element typeNode = RDFDomUtil.getChildNode(propertyNode, RDFDomUtil.RDFSCHEMA_NS, "range");
		String type = RDFDomUtil.getElementAttributeValue(typeNode, RDFDomUtil.RDF_NS, "resource");
		System.out.println(" attr - " + label );
		System.out.println("\tComment -> \t"  +comment);
		System.out.println("\tType -> \t" + type);
		
		System.out.println("");
		
	}

}
